require(['../../common'], function() {
    require(['site.index'])
})

define('site.index', [
    'jquery',
    'page/grid'
], function($, Grid) {
    'use strict';

    var $table = $('.table')
    var mygrid = new Grid($table)
    mygrid.init()

    $(document)
        .on('click', '#J_delsite', function() {
            delSite(getASelected(this))
        })

        function getASelected(t) {
            var current = mygrid.getCurrent(t)
            var selected = {
                id: [current.id],
                index: [current.index]
            }
            return selected
        }

        function delSite(selected) {
            if (confirm('删除站点将删除站点下所有数据，请谨慎操作！！！')) {
                location.href = APP + "?app=cms&m=Site&a=delSite&sid=" + selected.id.join();
            }
        }

})
